package com.seal.tsms.base.dao;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.criterion.DetachedCriteria;

import org.hibernate.transform.ResultTransformer;


import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * Created by seal.jing on 2015/12/21.
 */
public interface BaseDao<E extends Serializable,PK extends Serializable> {

    Session getSession();
    Criteria getCriteria();
    Query getQuery(String hql);
    SQLQuery getSQLQuery(String sql);
    Criteria getCriteria(DetachedCriteria detachedCriteria);
    Query getNamedQuery(String namedQuery);
    SQLQuery getNamedSQLQuery(String namedSQLQuery);
    Class getType();
    void save(E entity);
    void update(E entity);
    void delete(E entity);
    void merge(E entity);
    E get(PK id);
    List<?> list(String named, Map params,int firstResult,int maxResult ,ResultTransformer resultTransformer);
    List<?> list(DetachedCriteria detachedCriteria,int firstResult,int maxResult ,ResultTransformer resultTransformer);
    E findOne(String dsl,Map params);
    E findOne(DetachedCriteria detachedCriteria);
    int findCount(String named, Map params);
    int findCount(DetachedCriteria detachedCriteria);
    void browse(Pagination pagination);
    void batch(String named, Map params);

}
